#include "types.h"
#include "stat.h"
#include "user.h"

int
main(int argc, char *argv[])
{

  int (*foo)(char*, char*);
  foo = link;

  if(argc > 1 && strcmp(argv[1], "-s")==0){
	  argc--;
	  argv++;
	  foo = symlink;
  }

  if(argc != 3){
    printf(2, "Usage: ln [-s] old new\n");
    exit();
  }
  if(foo(argv[1], argv[2]) < 0)
    printf(2, "%s %s %s: failed\n",foo == symlink? "symlink": "link", argv[1], argv[2]);
  exit();
}
